import {createApp, watch} from 'vue'
import App from './App.vue'

import {createPinia} from 'pinia'

const pinia = createPinia()

// let ps = sessionStorage.getItem('ps')
// if (ps) {
//     pinia.state.value = JSON.parse(ps)
// }
// watch(pinia.state, state => {
//     sessionStorage.setItem('ps', JSON.stringify(state))
// }, {deep: true, immediate: true})

//1 npm i pinia-plugin-persistedstate --save安装持久化插件

//2 导入使用
import ppp from 'pinia-plugin-persistedstate'
pinia.use(ppp)
createApp(App).use(pinia).mount('#app')

//环境变量必须以大写的VITE_开头
console.log(import.meta.env.VITE_APP_BASE_API)
console.log(import.meta.env.VITE_APP_TITLE)
console.log(import.meta.env.VITE_AGE)
